(function(doc, win) {
	var controller = null;
	var tempParamData = null;
    // sui 页面就绪时间
    $(doc).on("pageInit", "#editEmployeePage", function(e, pageId, $page, isBack) {
        if(isBack) {
            $('#editEmployeePage  #shopId').val(employeeStoreListFilterParam.shopName);
            $("#editEmployeePage #shopId").attr("data-shopId",employeeStoreListFilterParam.shopId);
        } else {
            //默认进入该页面,默认清空页面信息;
            //$("#editEmployeePage .form-wrapper>ul>li>input").val("");
            //$("#editEmployeePage .form-wrapper>ul>li>i").css("display","none");
            //获取临时对象信息;
            tempParamData = CommonUtil.takeOutParamObject();
            if(tempParamData && tempParamData!=null){
                controller = new EditEmployeeController();
                controller.getEmployee(tempParamData.employeeId);
            }else{
                DialogUtil.dialogWarn("参数异常,无法编辑员工!");
                return false;
            }
            if (!employeeFilterParam.inited) {
                //获取门店数据
                new EmployeeFilterController().getShopList({}, null,false);
            }
             CommonUtil.render($("#userEditContainer"), "userEditTPL", {data: employeeFilterParam});
             $('#editEmployeePage .zhk-list_rarrow').addClass('disabled')
        }
     });
     
    
    //绑定编辑员工事件;
    $(doc).on("click","#editEmployeePage a[name='sub_edit']",function(){
    	if($('#editEmployeePage .btn').attr("class")=="btn disabled"){
    		return;
    	}
    	if(tempParamData && tempParamData!=null){
    	 	controller.editEmployee(tempParamData.employeeId);
    	}else{
    		 DialogUtil.dialogWarn("参数异常,无法编辑员工!");
    		 return false;
    	}
    
    });
    
    $(doc).on('input ', '#editEmployeePage .form>li>input', function () {
        if($(this).parents('li').siblings().find('input').val() != '' && $(this).val() != ''){
            $('#editEmployeePage .btn').removeClass('disabled')
        }
        else{
            $('#editEmployeePage .btn').addClass('disabled')
        }
     });
    
     $(doc).on('clearInput ', '#editEmployeePage .icon-ico_shutdown', function () {
        for(var i =0 ;i<$('.form li input').length;i++){
             if($('#editEmployeePage .form li input').eq(i).val() == ''){
                $('#editEmployeePage .btn').addClass('disabled')
            }
        }   
     });

    //门店筛选页面
  //  $(doc).on("click", "#editEmployeePage a[name='select_store']", function () {
   //     $.router.load("employee_store_list.html");
  //  });

})(document, window);